<?php

namespace App\Models;

use Brick\Math\RoundingMode;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

/**
 * App\Models\OrderRefund
 *
 * @property int $id
 * @property int $user_id
 * @property int $order_id
 * @property int $order_item_id
 * @property string $refund_money
 * @property string|null $type
 * @property string|null $reason
 * @property string|null $parcel_status
 * @property array|null $proof_images
 * @property bool $is_checked
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property-read \App\Models\Order $order
 * @property-read \App\Models\OrderItem $orderItem
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\OrderRefundNego[] $orderRefundNegos
 * @property-read int|null $order_refund_negos_count
 * @property-read \App\Models\User $user
 * @method static \Database\Factories\OrderRefundFactory factory(...$parameters)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund query()
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereIsChecked($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereOrderId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereOrderItemId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereParcelStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereProofImages($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereReason($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereRefundMoney($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereUserId($value)
 * @mixin \Eloquent
 * @property int $is_closed
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereIsClosed($value)
 * @property string|null $refund_number
 * @property string $refund_status
 * @property string|null $refund_failed_reason
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereRefundFailedReason($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereRefundNumber($value)
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereRefundStatus($value)
 * @property int $is_order_cancel
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereIsOrderCancel($value)
 * @property int $is_parcel_return
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereIsParcelReturn($value)
 * @property int $should_brokerage_return
 * @method static \Illuminate\Database\Eloquent\Builder|OrderRefund whereShouldBrokerageReturn($value)
 */
class OrderRefund extends Model
{
    use HasFactory;
	
	protected $guarded = ['id'];
	
	protected $casts = [
		'is_order_cancel' => 'boolean',
		'proof_images' => 'json',
	];
	
	public function user()
	{
		return $this->belongsTo(User::class);
	}
	
	public function order()
	{
		return $this->belongsTo(Order::class);
	}
	
	public function orderItem()
	{
		return $this->belongsTo(OrderItem::class);
	}
	
	public function orderRefundNegos()
	{
		return $this->hasMany(OrderRefundNego::class);
	}
}
